package com.example.basic.controller;

import com.example.basic.controller.dto.SoLineImportDTO;
import com.example.basic.service.ExcelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@Api(tags = "csv下载的控制器")
@RequestMapping("/excel")
public class ExcelController {

    private ExcelService excelService;

    @Autowired
    public ExcelController(ExcelService excelService) {
        this.excelService = excelService;
    }

    @PostMapping("/read")
    public List<SoLineImportDTO> testReadExcel(@ApiParam("file") MultipartFile file) {
        return excelService.readDataList(file);
    }
}
